<template>
<view class="my-list">
  <view class="my-item layout-center">
    <view class="tit flex-item1">头像</view>
    <image class="img" :src="avatar||'/static/image/img2.png'"></image>
  </view>
  <view class="my-item layout-center">
    <view class="tit flex-item1">昵称</view>
    <view class="cont">{{userNick}}</view>
  </view>
  <view class="my-item layout-center">
    <view class="tit flex-item1">绑定手机</view>
    <view class="cont">{{phone}}</view>
  </view>
  <view class="my-item layout-center">
    <view class="tit flex-item1">角色</view>
    <view class="cont">{{role}}</view>
  </view>
  <!-- <view>
	  <van-picker :columns="columns" @change="onChange" />
  </view> -->
</view>
</template>

<script>
var app = getApp();

export default {
  data() {
    return {
      userNick: '',
      avatar: '',
      phone: '',
      role: '',
	  user:false,
	  columns: ['杭州', '宁波', '温州', '嘉兴', '湖州'],
    };
  },

  components: {
	  "van-picker": "/wxcomponents/vant/dist/picker/index",
  },
  props: {},
  onLoad: function () {
    var that = this;
	this.user = uni.getStorageSync('user')
	console.log('user', this.user)
    if (uni.getStorageSync("userId")) {
      that.setData({
        userNick: uni.getStorageSync("userNick"),
        avatar: uni.getStorageSync("user_avatarUrl"),
        phone: uni.getStorageSync("userName"),
        role: uni.getStorageSync("userRole")
      });
    } else {
      app.globalData.doLogin();
    }
  },
  methods: {
	  onChange(event) {
	      console.log('event',event);
	   },
  }
};
</script>
<style>
page {
  position: relative;
}

.my-list {
  padding-bottom: 50px;
}

.my-item {
  line-height: 22px;
  background-color: #fff;
  padding: 10px 15px;
  margin-bottom: 1px;
}

.my-item .tit {
  color: #000;
  font-size: 14px;
}

.my-item .cont {
  color: #bbb;
  font-size: 12px;
}

.my-item .img {
  width: 48px;
  height: 48px;
  border-radius: 3px;
}

</style>